Skip to content

feat(serverless): address an environment on invoke and get_task (RUNSERV-1238) - #5

Merged
felixsanz merged 4 commits into
mainfrom
RUNSERV-1238-serverless-environment
Oct 23, 2026
Merged

felixsanz merged 4 commits into
mainfrom
RUNSERV-1238-serverless-environment

Conversation

@leszko

@leszko leszko commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RUNSERV-1238: an app id now names one copy per environment, so the client has to say which one it means.

  • Runware(serverless_environment="staging") sets it for the client; invoke(..., environment=) and get_task(..., environment=) override it per call.
  • Unset sends no environment parameter, so the platform reads production and existing callers send exactly the same requests as before.
  • Waiting polls in the invocation's environment. The task body carries no environment, so a poll without one would read production, 404, and fail once the 30s not-found grace runs out. The poll-timeout hint names the environment too.
  • Names are checked against the API's pattern before any request; a bad serverless_environment fails when the client is built.
  • An environment paused at its monthly budget (RUNSERV-1240) answers invoke with a 429 that holds until the budget is raised or the month turns. A 429 whose problem type is https://docs.runware.ai/serverless/errors#environment-paused is now a quota error raised at once, not retried and not slept on its Retry-After; any other 429 is retried as before. The pause PR must use that type.

The SDK has no deploy or app reads yet, so invoke and get_task are the whole surface this touches.

Release note: the prod API (as of bf039685) predates environments and ignores the parameter, which means a non-production call would reach the production copy. Publish only once prod runs Runware/serverless#787 or later; dev already does. Merge after the RUNSERV-1240 pause work, so the paused type above is live.

Tested: ruff, pyright, pytest (360 passed), and a local run against the serverless API from main with production and staging copies of one app: each copy's tasks ran on its own consumer and were readable only in their own environment. Against the prod API commit, environment=staging ran on the production copy, hence the release note.

…ERV-1238)

An app id now names one copy per environment. The client takes
serverless_environment, each call can override it, and unset sends
nothing so the platform keeps reading production. Waiting polls in the
invocation's environment, since a task carries none of its own.

Signed-off-by: Rafal Leszko <rafal.leszko@runware.ai>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include coderabbit-review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 564bb756-50ab-4554-a650-942a38199b51

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

… wrappers (RUNSERV-1238)

Review follow-ups: an invalid serverless_environment now fails when the
client is built and names the config field, the name must match in
full (no trailing newline), and the query goes through urlencode. Tests
cover the public Runware wrappers, the name boundaries and the
smoke test's optional RUNWARE_SERVERLESS_TEST_ENVIRONMENT.

Signed-off-by: Rafal Leszko <rafal.leszko@runware.ai>
…(RUNSERV-1238)

Signed-off-by: Rafal Leszko <rafal.leszko@runware.ai>
…RUNSERV-1238)

A paused environment answers invoke with a 429 that holds until the
budget is raised or the UTC month turns, so retrying it, or sleeping
on its Retry-After, only delays the error. It now raises a quota error
at once; any other 429 is still retried.

Signed-off-by: Rafal Leszko <rafal.leszko@runware.ai>
@leszko
leszko marked this pull request as ready for review October 21, 2026 11:37
@leszko
leszko requested review from fedegr and felixsanz October 21, 2026 11:38
@felixsanz
felixsanz merged commit f13a420 into main Oct 23, 2026
3 checks passed
@felixsanz
felixsanz deleted the RUNSERV-1238-serverless-environment branch October 23, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants